﻿<Application x:Class="SoftSource.Timecard.Entry.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:app="clr-namespace:SoftSource.Timecard.Entry"
             xmlns:res="clr-namespace:SoftSource.Timecard.Entry.Resources"
             xmlns:appsvc="clr-namespace:System.Windows.Ria.ApplicationServices;assembly=System.Windows.Ria"
             xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
             xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
             xmlns:System_Windows_Controls_Primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls"
             xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
             xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
             xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
             xmlns:softsourceConverters="clr-namespace:SoftSource.Common.Converters;assembly=SoftSource.Common.Silverlight"
             xmlns:converters="clr-namespace:SoftSource.Timecard.Entry.Converters"
             Startup="Application_Startup"
             UnhandledException="Application_UnhandledException">

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Assets/Styles.xaml" />
                <ResourceDictionary>
                    <res:ResourceWrapper x:Key="ResourceWrapper" />
                    <app:NotOperatorValueConverter x:Key="NotOperatorValueConverter" />
                </ResourceDictionary>
                <ResourceDictionary Source="/SoftSourceResources;Component/SoftSourceLogos.xaml" />
                <ResourceDictionary Source="/SoftSourceResources;Component/SoftSourceResources.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <!--Stateless Converters-->
            <converters:BillingFrequencyIDConverter x:Key="BillingFrequencyIDConverter" />
            <converters:BillingStateIDConverter x:Key="BillingStateIDConverter" />
            <converters:CategoryIDConverter x:Key="CategoryIDConverter" />
            <converters:ProjectIDConverter x:Key="ProjectIDConverter" />
            <converters:ProjectStatusIDConverter x:Key="ProjectStatusIDConverter" />
            <converters:ProjectTypeIDConverter x:Key="ProjectTypeIDConverter" />
            <converters:RevenueTypeIDConverter x:Key="RevenueTypeIDConverter" />
            <converters:RoleIDConverter x:Key="RoleIDConverter" />
            <converters:UserIDConverter x:Key="UserIDConverter" />
            <converters:UserTypeIDConverter x:Key="UserTypeIDConverter" />
            <converters:RoleToVisibilityConverter x:Key="RoleToVisibilityConverter" />
            <converters:RoleToBoolConverter x:Key="RoleToBoolConverter" />
            <converters:ObjectToExecutingAssemblyVersionConverter x:Key="ObjectToExecutingAssemblyVersionConverter" />
            <softsourceConverters:ObjectToBoolConverter x:Key="ObjectToBoolConverter" />
            <softsourceConverters:ObjectToVisibilityConverter x:Key="ObjectToVisibilityConverter" />
            <softsourceConverters:FormattedDateConverter x:Key="FormattedDateConverter" />

            <SolidColorBrush x:Key="ArrowFillBrush"
                             Color="#FF8B8787" />

            <Style x:Key="TimecardTabControlStyle"
                   TargetType="controls:TabControl">
                <Setter Property="IsTabStop"
                        Value="False" />
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1"
                                             StartPoint="0.5,0">
                            <GradientStop Color="#FFFFFFFF"
                                          Offset="0" />
                            <GradientStop Color="#FFFEFEFE"
                                          Offset="1" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
                <Setter Property="BorderBrush">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1"
                                             StartPoint="0.5,0">
                            <GradientStop Color="#FFA3AEB9"
                                          Offset="0" />
                            <GradientStop Color="#FF8399A9"
                                          Offset="0.375" />
                            <GradientStop Color="#FF718597"
                                          Offset="0.375" />
                            <GradientStop Color="#FF617584"
                                          Offset="1" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
                <Setter Property="BorderThickness"
                        Value="1" />
                <Setter Property="Padding"
                        Value="5" />
                <Setter Property="HorizontalContentAlignment"
                        Value="Stretch" />
                <Setter Property="VerticalContentAlignment"
                        Value="Stretch" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="controls:TabControl">
                            <Grid>
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualStateGroup.Transitions>
                                            <VisualTransition GeneratedDuration="0" />
                                        </VisualStateGroup.Transitions>
                                        <VisualState x:Name="Normal" />
                                        <VisualState x:Name="Disabled">
                                            <Storyboard>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualTop"
                                                                               Storyboard.TargetProperty="Opacity">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualBottom"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualLeft"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualRight"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Grid x:Name="TemplateTop"
                                      Visibility="Collapsed">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <System_Windows_Controls_Primitives:TabPanel x:Name="TabPanelTop"
                                                                                 Margin="20,2,2,-1"
                                                                                 Canvas.ZIndex="1" />
                                    <Border MinHeight="10"
                                            MinWidth="10"
                                            Grid.Row="1"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}"
                                            CornerRadius="5,5,0,0">
                                        <ContentPresenter x:Name="ContentTop"
                                                          Cursor="{TemplateBinding Cursor}"
                                                          HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                          Margin="{TemplateBinding Padding}"
                                                          VerticalAlignment="{TemplateBinding VerticalAlignment}" />
                                    </Border>
                                    <Border x:Name="DisabledVisualTop"
                                            IsHitTestVisible="False"
                                            Opacity="0"
                                            Grid.Row="1"
                                            Grid.RowSpan="2"
                                            Canvas.ZIndex="1"
                                            Background="#8CFFFFFF"
                                            CornerRadius="0,0,3,3" />
                                </Grid>
                                <Grid x:Name="TemplateBottom"
                                      Visibility="Collapsed">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <System_Windows_Controls_Primitives:TabPanel x:Name="TabPanelBottom"
                                                                                 Margin="2,-1,2,2"
                                                                                 Grid.Row="1"
                                                                                 Canvas.ZIndex="1" />
                                    <Border MinHeight="10"
                                            MinWidth="10"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}"
                                            CornerRadius="3,3,0,0">
                                        <ContentPresenter x:Name="ContentBottom"
                                                          Cursor="{TemplateBinding Cursor}"
                                                          HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                          Margin="{TemplateBinding Padding}"
                                                          VerticalAlignment="{TemplateBinding VerticalAlignment}" />
                                    </Border>
                                    <Border x:Name="DisabledVisualBottom"
                                            IsHitTestVisible="False"
                                            Opacity="0"
                                            Canvas.ZIndex="1"
                                            Background="#8CFFFFFF"
                                            CornerRadius="3,3,0,0" />
                                </Grid>
                                <Grid x:Name="TemplateLeft"
                                      Visibility="Collapsed">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <System_Windows_Controls_Primitives:TabPanel x:Name="TabPanelLeft"
                                                                                 Margin="2,2,-1,2"
                                                                                 Canvas.ZIndex="1" />
                                    <Border MinHeight="10"
                                            MinWidth="10"
                                            Grid.Column="1"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}"
                                            CornerRadius="0,3,3,0">
                                        <ContentPresenter x:Name="ContentLeft"
                                                          Cursor="{TemplateBinding Cursor}"
                                                          HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                          Margin="{TemplateBinding Padding}"
                                                          VerticalAlignment="{TemplateBinding VerticalAlignment}" />
                                    </Border>
                                    <Border x:Name="DisabledVisualLeft"
                                            IsHitTestVisible="False"
                                            Opacity="0"
                                            Grid.Column="1"
                                            Canvas.ZIndex="1"
                                            Background="#8CFFFFFF"
                                            CornerRadius="0,3,3,0" />
                                </Grid>
                                <Grid x:Name="TemplateRight"
                                      Visibility="Collapsed">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <System_Windows_Controls_Primitives:TabPanel x:Name="TabPanelRight"
                                                                                 Margin="-1,2,2,2"
                                                                                 Grid.Column="1"
                                                                                 Canvas.ZIndex="1" />
                                    <Border MinHeight="10"
                                            MinWidth="10"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}"
                                            CornerRadius="3,0,0,3">
                                        <ContentPresenter x:Name="ContentRight"
                                                          Cursor="{TemplateBinding Cursor}"
                                                          HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                          Margin="{TemplateBinding Padding}"
                                                          VerticalAlignment="{TemplateBinding VerticalAlignment}" />
                                    </Border>
                                    <Border x:Name="DisabledVisualRight"
                                            Margin="0"
                                            IsHitTestVisible="False"
                                            Opacity="0"
                                            Canvas.ZIndex="1"
                                            Background="#8CFFFFFF"
                                            CornerRadius="3,0,0,3" />
                                </Grid>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="TimecardTabItemStyle"
                   TargetType="controls:TabItem">
                <Setter Property="IsTabStop"
                        Value="False" />
                <Setter Property="Background"
                        Value="#FF1F3B53" />
                <Setter Property="BorderBrush"
                        Value="#FFA3AEB9" />
                <Setter Property="BorderThickness"
                        Value="1" />
                <Setter Property="Padding"
                        Value="6,2,6,2" />
                <Setter Property="HorizontalContentAlignment"
                        Value="Stretch" />
                <Setter Property="VerticalContentAlignment"
                        Value="Stretch" />
                <Setter Property="MinWidth"
                        Value="5" />
                <Setter Property="MinHeight"
                        Value="5" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="controls:TabItem">
                            <Grid x:Name="Root">
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualStateGroup.Transitions>
                                            <VisualTransition GeneratedDuration="0" />
                                            <VisualTransition GeneratedDuration="0:0:0.1"
                                                              To="MouseOver" />
                                        </VisualStateGroup.Transitions>
                                        <VisualState x:Name="Normal" />
                                        <VisualState x:Name="MouseOver">
                                            <Storyboard>
                                                <ColorAnimationUsingKeyFrames BeginTime="0"
                                                                              Duration="00:00:00.001"
                                                                              Storyboard.TargetName="GradientBottom"
                                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                                                    <SplineColorKeyFrame KeyTime="0"
                                                                         Value="#7FFFFFFF" />
                                                </ColorAnimationUsingKeyFrames>
                                                <ColorAnimationUsingKeyFrames BeginTime="0"
                                                                              Duration="00:00:00.001"
                                                                              Storyboard.TargetName="GradientBottom"
                                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                                                    <SplineColorKeyFrame KeyTime="0"
                                                                         Value="#CCFFFFFF" />
                                                </ColorAnimationUsingKeyFrames>
                                                <ColorAnimationUsingKeyFrames BeginTime="0"
                                                                              Duration="00:00:00.001"
                                                                              Storyboard.TargetName="GradientBottom"
                                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                                    <SplineColorKeyFrame KeyTime="0"
                                                                         Value="#F2FFFFFF" />
                                                </ColorAnimationUsingKeyFrames>
                                                <ColorAnimationUsingKeyFrames BeginTime="0"
                                                                              Duration="00:00:00.001"
                                                                              Storyboard.TargetName="GradientLeft"
                                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                                                    <SplineColorKeyFrame KeyTime="0"
                                                                         Value="#7FFFFFFF" />
                                                </ColorAnimationUsingKeyFrames>
                                                <ColorAnimationUsingKeyFrames BeginTime="0"
                                                                              Duration="00:00:00.001"
                                                                              Storyboard.TargetName="GradientLeft"
                                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                                                    <SplineColorKeyFrame KeyTime="0"
                                                                         Value="#CCFFFFFF" />
                                                </ColorAnimationUsingKeyFrames>
                                                <ColorAnimationUsingKeyFrames BeginTime="0"
                                                                              Duration="00:00:00.001"
                                                                              Storyboard.TargetName="GradientLeft"
                                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                                    <SplineColorKeyFrame KeyTime="0"
                                                                         Value="#F2FFFFFF" />
                                                </ColorAnimationUsingKeyFrames>
                                                <ColorAnimationUsingKeyFrames BeginTime="0"
                                                                              Duration="00:00:00.001"
                                                                              Storyboard.TargetName="GradientRight"
                                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                                                    <SplineColorKeyFrame KeyTime="0"
                                                                         Value="#7FFFFFFF" />
                                                </ColorAnimationUsingKeyFrames>
                                                <ColorAnimationUsingKeyFrames BeginTime="0"
                                                                              Duration="00:00:00.001"
                                                                              Storyboard.TargetName="GradientRight"
                                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                                                    <SplineColorKeyFrame KeyTime="0"
                                                                         Value="#CCFFFFFF" />
                                                </ColorAnimationUsingKeyFrames>
                                                <ColorAnimationUsingKeyFrames BeginTime="0"
                                                                              Duration="00:00:00.001"
                                                                              Storyboard.TargetName="GradientRight"
                                                                              Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                                    <SplineColorKeyFrame KeyTime="0"
                                                                         Value="#F2FFFFFF" />
                                                </ColorAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames BeginTime="0"
                                                                               Duration="00:00:00.001"
                                                                               Storyboard.TargetName="FocusVisualBottom"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="0" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames BeginTime="0"
                                                                               Duration="00:00:00.001"
                                                                               Storyboard.TargetName="FocusVisualLeft"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="0" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames BeginTime="0"
                                                                               Duration="00:00:00.001"
                                                                               Storyboard.TargetName="FocusVisualRight"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="0" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                              Duration="00:00:00.0010000"
                                                                              Storyboard.TargetName="GradientTop"
                                                                              Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                                                    <EasingColorKeyFrame KeyTime="00:00:00"
                                                                         Value="#33999999" />
                                                </ColorAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                               Duration="00:00:00.0010000"
                                                                               Storyboard.TargetName="border"
                                                                               Storyboard.TargetProperty="(Border.CornerRadius)">
                                                    <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <CornerRadius>6,6,0,0</CornerRadius>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                               Duration="00:00:00.0010000"
                                                                               Storyboard.TargetName="border1"
                                                                               Storyboard.TargetProperty="(Border.CornerRadius)">
                                                    <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <CornerRadius>5,5,0,0</CornerRadius>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Disabled">
                                            <Storyboard>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualTopSelected"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualTopUnSelected"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualBottomSelected"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualBottomUnSelected"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualLeftSelected"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualLeftUnSelected"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualRightSelected"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualRightUnSelected"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="SelectionStates">
                                        <VisualState x:Name="Unselected" />
                                        <VisualState x:Name="Selected" />
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="FocusStates">
                                        <VisualState x:Name="Focused">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="FocusVisualBottom"
                                                                               Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="FocusVisualLeft"
                                                                               Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="FocusVisualRight"
                                                                               Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Unfocused">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="FocusVisualElement"
                                                                               Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="Collapsed" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Grid x:Name="TemplateTopSelected"
                                      Visibility="Collapsed"
                                      Canvas.ZIndex="1">
                                    <Border x:Name="border"
                                            Margin="-2,-2,-2,0"
                                            BorderThickness="1,1,1,0"
                                            CornerRadius="6,6,0,0">
                                        <Border x:Name="border1"
                                                BorderThickness="1,1,1,0"
                                                CornerRadius="5,5,0,0"
                                                BorderBrush="#66999999">
                                            <Grid>
                                                <Border Background="#FFFFFFFF"
                                                        Margin="0,0,0,-2"
                                                        CornerRadius="4,4,0,0" />
                                                <ContentControl x:Name="HeaderTopSelected"
                                                                IsTabStop="False"
                                                                Cursor="{TemplateBinding Cursor}"
                                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                                Margin="{TemplateBinding Padding}"
                                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                                Foreground="#FF488EBD"
                                                                FontSize="14.667" />
                                            </Grid>
                                        </Border>
                                    </Border>
                                    <Border x:Name="DisabledVisualTopSelected"
                                            Margin="-2,-2,-2,0"
                                            IsHitTestVisible="false"
                                            Opacity="0"
                                            Background="#8CFFFFFF"
                                            CornerRadius="3,3,0,0" />
                                </Grid>
                                <Grid x:Name="TemplateTopUnselected"
                                      Visibility="Collapsed">
                                    <Border x:Name="BorderTop"
                                            BorderThickness="1"
                                            CornerRadius="3,3,0,0">
                                        <Border x:Name="GradientTop"
                                                BorderThickness="1,1,1,0"
                                                CornerRadius="4,4,0,0">
                                            <Border.BorderBrush>
                                                <SolidColorBrush />
                                            </Border.BorderBrush>
                                            <Grid>
                                                <ContentControl x:Name="HeaderTopUnselected"
                                                                FontSize="14.667"
                                                                IsTabStop="False"
                                                                Cursor="{TemplateBinding Cursor}"
                                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                                Margin="{TemplateBinding Padding}"
                                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                                                Foreground="#FF68A2C9" />
                                            </Grid>
                                        </Border>
                                    </Border>
                                    <Border x:Name="DisabledVisualTopUnSelected"
                                            IsHitTestVisible="false"
                                            Opacity="0"
                                            Background="#8CFFFFFF"
                                            CornerRadius="3,3,0,0" />
                                </Grid>
                                <Grid x:Name="TemplateBottomSelected"
                                      Visibility="Collapsed"
                                      Canvas.ZIndex="1">
                                    <Border Margin="-2,0,-2,-2"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="1,0,1,1"
                                            CornerRadius="0,0,3,3">
                                        <Border BorderBrush="#FFFFFFFF"
                                                BorderThickness="1"
                                                CornerRadius="0,0,1,1">
                                            <Border.Background>
                                                <LinearGradientBrush EndPoint=".7,1"
                                                                     StartPoint=".7,0">
                                                    <GradientStop Color="#FFFFFFFF"
                                                                  Offset="0" />
                                                    <GradientStop Color="#F9FFFFFF"
                                                                  Offset="0.375" />
                                                    <GradientStop Color="#E5FFFFFF"
                                                                  Offset="0.625" />
                                                    <GradientStop Color="#C6FFFFFF"
                                                                  Offset="1" />
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <Grid>
                                                <Rectangle Fill="#FFFFFFFF"
                                                           Margin="0,-2,0,0" />
                                                <ContentControl x:Name="HeaderBottomSelected"
                                                                FontSize="{TemplateBinding FontSize}"
                                                                Foreground="{TemplateBinding Foreground}"
                                                                IsTabStop="False"
                                                                Cursor="{TemplateBinding Cursor}"
                                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                                Margin="{TemplateBinding Padding}"
                                                                VerticalAlignment="{TemplateBinding VerticalAlignment}" />
                                            </Grid>
                                        </Border>
                                    </Border>
                                    <Border x:Name="FocusVisualBottom"
                                            Margin="-2,0,-2,-2"
                                            IsHitTestVisible="false"
                                            Visibility="Collapsed"
                                            BorderBrush="#FF6DBDD1"
                                            BorderThickness="1,0,1,1"
                                            CornerRadius="0,0,3,3" />
                                    <Border x:Name="DisabledVisualBottomSelected"
                                            Margin="-2,0,-2,-2"
                                            IsHitTestVisible="false"
                                            Opacity="0"
                                            Background="#8CFFFFFF"
                                            CornerRadius="0,0,3,3" />
                                </Grid>
                                <Grid x:Name="TemplateBottomUnselected"
                                      Visibility="Collapsed">
                                    <Border x:Name="BorderBottom"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="1"
                                            CornerRadius="0,0,3,3">
                                        <Border x:Name="GradientBottom"
                                                BorderBrush="#FFFFFFFF"
                                                BorderThickness="1"
                                                CornerRadius="0,0,1,1">
                                            <Border.Background>
                                                <LinearGradientBrush EndPoint=".7,1"
                                                                     StartPoint=".7,0">
                                                    <GradientStop Color="#FFFFFFFF"
                                                                  Offset="0" />
                                                    <GradientStop Color="#F9FFFFFF"
                                                                  Offset="0.375" />
                                                    <GradientStop Color="#E5FFFFFF"
                                                                  Offset="0.625" />
                                                    <GradientStop Color="#C6FFFFFF"
                                                                  Offset="1" />
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <Grid>
                                                <ContentControl x:Name="HeaderBottomUnselected"
                                                                FontSize="{TemplateBinding FontSize}"
                                                                Foreground="{TemplateBinding Foreground}"
                                                                IsTabStop="False"
                                                                Cursor="{TemplateBinding Cursor}"
                                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                                Margin="{TemplateBinding Padding}"
                                                                VerticalAlignment="{TemplateBinding VerticalAlignment}" />
                                            </Grid>
                                        </Border>
                                    </Border>
                                    <Border x:Name="DisabledVisualBottomUnSelected"
                                            IsHitTestVisible="false"
                                            Opacity="0"
                                            Background="#8CFFFFFF"
                                            CornerRadius="0,0,3,3" />
                                </Grid>
                                <Grid x:Name="TemplateLeftSelected"
                                      Visibility="Collapsed"
                                      Canvas.ZIndex="1">
                                    <Border Margin="-2,-2,0,-2"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="1,1,0,1"
                                            CornerRadius="3,0,0,3">
                                        <Border BorderBrush="#FFFFFFFF"
                                                BorderThickness="1"
                                                CornerRadius="1,0,0,1">
                                            <Border.Background>
                                                <LinearGradientBrush EndPoint=".7,1"
                                                                     StartPoint=".7,0">
                                                    <GradientStop Color="#FFFFFFFF"
                                                                  Offset="0" />
                                                    <GradientStop Color="#F9FFFFFF"
                                                                  Offset="0.375" />
                                                    <GradientStop Color="#E5FFFFFF"
                                                                  Offset="0.625" />
                                                    <GradientStop Color="#C6FFFFFF"
                                                                  Offset="1" />
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <Grid>
                                                <Rectangle Fill="#FFFFFFFF"
                                                           Margin="0,0,-2,0" />
                                                <ContentControl x:Name="HeaderLeftSelected"
                                                                FontSize="{TemplateBinding FontSize}"
                                                                Foreground="{TemplateBinding Foreground}"
                                                                IsTabStop="False"
                                                                Cursor="{TemplateBinding Cursor}"
                                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                                Margin="{TemplateBinding Padding}"
                                                                VerticalAlignment="{TemplateBinding VerticalAlignment}" />
                                            </Grid>
                                        </Border>
                                    </Border>
                                    <Border x:Name="FocusVisualLeft"
                                            Margin="-2,-2,0,-2"
                                            IsHitTestVisible="false"
                                            Visibility="Collapsed"
                                            BorderBrush="#FF6DBDD1"
                                            BorderThickness="1,1,0,1"
                                            CornerRadius="3,0,0,3" />
                                    <Border x:Name="DisabledVisualLeftSelected"
                                            Margin="-2,-2,0,-2"
                                            IsHitTestVisible="false"
                                            Opacity="0"
                                            Background="#8CFFFFFF"
                                            CornerRadius="3,0,0,3" />
                                </Grid>
                                <Grid x:Name="TemplateLeftUnselected"
                                      Visibility="Collapsed">
                                    <Border x:Name="BorderLeft"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}"
                                            CornerRadius="3,0,0,3">
                                        <Border x:Name="GradientLeft"
                                                BorderBrush="#FFFFFFFF"
                                                BorderThickness="1"
                                                CornerRadius="1,0,0,1">
                                            <Border.Background>
                                                <LinearGradientBrush EndPoint=".7,1"
                                                                     StartPoint=".7,0">
                                                    <GradientStop Color="#FFFFFFFF"
                                                                  Offset="0" />
                                                    <GradientStop Color="#F9FFFFFF"
                                                                  Offset="0.375" />
                                                    <GradientStop Color="#E5FFFFFF"
                                                                  Offset="0.625" />
                                                    <GradientStop Color="#C6FFFFFF"
                                                                  Offset="1" />
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <Grid>
                                                <ContentControl x:Name="HeaderLeftUnselected"
                                                                FontSize="{TemplateBinding FontSize}"
                                                                Foreground="{TemplateBinding Foreground}"
                                                                IsTabStop="False"
                                                                Cursor="{TemplateBinding Cursor}"
                                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                                Margin="{TemplateBinding Padding}"
                                                                VerticalAlignment="{TemplateBinding VerticalAlignment}" />
                                            </Grid>
                                        </Border>
                                    </Border>
                                    <Border x:Name="DisabledVisualLeftUnSelected"
                                            IsHitTestVisible="false"
                                            Opacity="0"
                                            Background="#8CFFFFFF"
                                            CornerRadius="3,0,0,3" />
                                </Grid>
                                <Grid x:Name="TemplateRightSelected"
                                      Visibility="Collapsed"
                                      Canvas.ZIndex="1">
                                    <Border Margin="0,-2,-2,-2"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="0,1,1,1"
                                            CornerRadius="0,3,3,0">
                                        <Border BorderBrush="#FFFFFFFF"
                                                BorderThickness="1"
                                                CornerRadius="0,1,1,0">
                                            <Border.Background>
                                                <LinearGradientBrush EndPoint=".7,1"
                                                                     StartPoint=".7,0">
                                                    <GradientStop Color="#FFFFFFFF"
                                                                  Offset="0" />
                                                    <GradientStop Color="#F9FFFFFF"
                                                                  Offset="0.375" />
                                                    <GradientStop Color="#E5FFFFFF"
                                                                  Offset="0.625" />
                                                    <GradientStop Color="#C6FFFFFF"
                                                                  Offset="1" />
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <Grid>
                                                <Rectangle Fill="#FFFFFFFF"
                                                           Margin="-2,0,0,0" />
                                                <ContentControl x:Name="HeaderRightSelected"
                                                                FontSize="{TemplateBinding FontSize}"
                                                                Foreground="{TemplateBinding Foreground}"
                                                                IsTabStop="False"
                                                                Cursor="{TemplateBinding Cursor}"
                                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                                Margin="{TemplateBinding Padding}"
                                                                VerticalAlignment="{TemplateBinding VerticalAlignment}" />
                                            </Grid>
                                        </Border>
                                    </Border>
                                    <Border x:Name="FocusVisualRight"
                                            Margin="0,-2,-2,-2"
                                            IsHitTestVisible="false"
                                            Visibility="Collapsed"
                                            BorderBrush="#FF6DBDD1"
                                            BorderThickness="0,1,1,1"
                                            CornerRadius="0,3,3,0" />
                                    <Border x:Name="DisabledVisualRightSelected"
                                            Margin="0,-2,-2,-2"
                                            IsHitTestVisible="false"
                                            Opacity="0"
                                            Background="#8CFFFFFF"
                                            CornerRadius="0,3,3,0" />
                                </Grid>
                                <Grid x:Name="TemplateRightUnselected"
                                      Visibility="Collapsed">
                                    <Border x:Name="BorderRight"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="1"
                                            CornerRadius="0,3,3,0">
                                        <Border x:Name="GradientRight"
                                                BorderBrush="#FFFFFFFF"
                                                BorderThickness="1"
                                                CornerRadius="0,1,1,0">
                                            <Border.Background>
                                                <LinearGradientBrush EndPoint=".7,1"
                                                                     StartPoint=".7,0">
                                                    <GradientStop Color="#FFFFFFFF"
                                                                  Offset="0" />
                                                    <GradientStop Color="#F9FFFFFF"
                                                                  Offset="0.375" />
                                                    <GradientStop Color="#E5FFFFFF"
                                                                  Offset="0.625" />
                                                    <GradientStop Color="#C6FFFFFF"
                                                                  Offset="1" />
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <Grid>
                                                <ContentControl x:Name="HeaderRightUnselected"
                                                                FontSize="{TemplateBinding FontSize}"
                                                                Foreground="{TemplateBinding Foreground}"
                                                                IsTabStop="False"
                                                                Cursor="{TemplateBinding Cursor}"
                                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                                                Margin="{TemplateBinding Padding}"
                                                                VerticalAlignment="{TemplateBinding VerticalAlignment}" />
                                            </Grid>
                                        </Border>
                                    </Border>
                                    <Border x:Name="DisabledVisualRightUnSelected"
                                            IsHitTestVisible="false"
                                            Opacity="0"
                                            Background="#8CFFFFFF"
                                            CornerRadius="0,3,3,0" />
                                </Grid>
                                <Border x:Name="FocusVisualElement"
                                        Margin="-1"
                                        IsHitTestVisible="false"
                                        Visibility="Collapsed"
                                        BorderBrush="#FF6DBDD1"
                                        BorderThickness="1"
                                        CornerRadius="3,3,0,0" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="ReverseExpanderStyle"
                   TargetType="controlsToolkit:Expander">
                <Setter Property="BorderThickness"
                        Value="1" />
                <Setter Property="HorizontalContentAlignment"
                        Value="Stretch" />
                <Setter Property="VerticalContentAlignment"
                        Value="Stretch" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="controlsToolkit:Expander">
                            <Grid Background="Transparent">
                                <Grid.Resources>
                                    <LinearGradientBrush x:Key="ExpanderArrowFill"
                                                         EndPoint="0,1"
                                                         StartPoint="0,0">
                                        <GradientStop Color="White"
                                                      Offset="0" />
                                        <GradientStop Color="#FFBFBFBF"
                                                      Offset="0.5" />
                                        <GradientStop Color="#FF878787"
                                                      Offset="1" />
                                    </LinearGradientBrush>
                                    <LinearGradientBrush x:Key="ExpanderArrowHoverFill"
                                                         EndPoint="0,1"
                                                         StartPoint="0,0">
                                        <GradientStop Color="#FFF0F8FE"
                                                      Offset="0" />
                                        <GradientStop Color="#FFE0F3FE"
                                                      Offset="0.3" />
                                        <GradientStop Color="#FF6FA7C5"
                                                      Offset="1" />
                                    </LinearGradientBrush>
                                    <LinearGradientBrush x:Key="ExpanderArrowPressedFill"
                                                         EndPoint="0,1"
                                                         StartPoint="0,0">
                                        <GradientStop Color="#FFDCF0FA"
                                                      Offset="0" />
                                        <GradientStop Color="#FFC5E6F7"
                                                      Offset="0.2" />
                                        <GradientStop Color="#FF5690D0"
                                                      Offset="1" />
                                    </LinearGradientBrush>
                                    <ControlTemplate x:Key="ExpanderDownHeaderTemplate"
                                                     TargetType="ToggleButton">
                                        <Grid Background="Transparent">
                                            <VisualStateManager.VisualStateGroups>
                                                <VisualStateGroup x:Name="CheckStates">
                                                    <VisualStateGroup.Transitions>
                                                        <VisualTransition GeneratedDuration="00:00:00" />
                                                    </VisualStateGroup.Transitions>
                                                    <VisualState x:Name="Checked">
                                                        <Storyboard>
                                                            <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                           Storyboard.TargetName="arrow"
                                                                                           Storyboard.TargetProperty="Data">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="M 1,4.5 L 4.5,1 L 8,4.5" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Unchecked" />
                                                </VisualStateGroup>
                                                <VisualStateGroup x:Name="CommonStates">
                                                    <VisualStateGroup.Transitions>
                                                        <VisualTransition GeneratedDuration="0" />
                                                        <VisualTransition GeneratedDuration="00:00:00.1"
                                                                          To="MouseOver" />
                                                        <VisualTransition GeneratedDuration="00:00:00.1"
                                                                          To="Pressed" />
                                                    </VisualStateGroup.Transitions>
                                                    <VisualState x:Name="Normal" />
                                                    <VisualState x:Name="MouseOver">
                                                        <Storyboard>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="circle"
                                                                            Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)"
                                                                            To="#FF3C7FB1" />
                                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle"
                                                                                           Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="{StaticResource ExpanderArrowHoverFill}" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="arrow"
                                                                            Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)"
                                                                            To="#222" />
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Pressed">
                                                        <Storyboard>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="circle"
                                                                            Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)"
                                                                            To="#FF526C7B" />
                                                            <DoubleAnimation BeginTime="0"
                                                                             Storyboard.TargetName="circle"
                                                                             Storyboard.TargetProperty="StrokeThickness"
                                                                             To="1.5" />
                                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle"
                                                                                           Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="{StaticResource ExpanderArrowPressedFill}" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="arrow"
                                                                            Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)"
                                                                            To="#FF003366" />
                                                        </Storyboard>
                                                    </VisualState>
                                                </VisualStateGroup>
                                                <VisualStateGroup x:Name="FocusStates">
                                                    <VisualState x:Name="Focused">
                                                        <Storyboard>
                                                            <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                           Storyboard.TargetName="FocusVisualElement"
                                                                                           Storyboard.TargetProperty="Visibility">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="Visible" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Unfocused" />
                                                </VisualStateGroup>
                                            </VisualStateManager.VisualStateGroups>
                                            <Border Padding="{TemplateBinding Padding}">
                                                <Grid Background="Transparent">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*" />
                                                        <ColumnDefinition Width="19" />
                                                    </Grid.ColumnDefinitions>
                                                    <Grid HorizontalAlignment="Left"
                                                          VerticalAlignment="Top"
                                                          Grid.Column="1">
                                                        <Ellipse x:Name="circle"
                                                                 Fill="{StaticResource ExpanderArrowFill}"
                                                                 Stroke="DarkGray"
                                                                 Height="19"
                                                                 HorizontalAlignment="Center"
                                                                 VerticalAlignment="Center"
                                                                 Width="19" />
                                                        <Path x:Name="arrow"
                                                              Stroke="#666"
                                                              StrokeThickness="2"
                                                              HorizontalAlignment="Center"
                                                              VerticalAlignment="Center"
                                                              Data="M 1,1.5 L 4.5,5 L 8,1.5" />
                                                    </Grid>
                                                    <ContentPresenter x:Name="header"
                                                                      HorizontalAlignment="Right"
                                                                      Margin="4,0"
                                                                      VerticalAlignment="Center"
                                                                      Grid.Column="0"
                                                                      Content="{TemplateBinding Content}"
                                                                      ContentTemplate="{TemplateBinding ContentTemplate}" />
                                                </Grid>
                                            </Border>
                                            <Rectangle x:Name="FocusVisualElement"
                                                       Stroke="#FF448DCA"
                                                       StrokeThickness="1"
                                                       IsHitTestVisible="false"
                                                       Visibility="Collapsed" />
                                        </Grid>
                                    </ControlTemplate>
                                    <ControlTemplate x:Key="ExpanderUpHeaderTemplate"
                                                     TargetType="ToggleButton">
                                        <Grid Background="Transparent">
                                            <VisualStateManager.VisualStateGroups>
                                                <VisualStateGroup x:Name="CheckStates">
                                                    <VisualStateGroup.Transitions>
                                                        <VisualTransition GeneratedDuration="00:00:00" />
                                                    </VisualStateGroup.Transitions>
                                                    <VisualState x:Name="Checked">
                                                        <Storyboard>
                                                            <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                           Storyboard.TargetName="arrow"
                                                                                           Storyboard.TargetProperty="Data">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="M 1,4.5 L 4.5,1 L 8,4.5" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Unchecked" />
                                                </VisualStateGroup>
                                                <VisualStateGroup x:Name="CommonStates">
                                                    <VisualStateGroup.Transitions>
                                                        <VisualTransition GeneratedDuration="0" />
                                                        <VisualTransition GeneratedDuration="00:00:00.1"
                                                                          To="MouseOver" />
                                                        <VisualTransition GeneratedDuration="00:00:00.1"
                                                                          To="Pressed" />
                                                    </VisualStateGroup.Transitions>
                                                    <VisualState x:Name="Normal" />
                                                    <VisualState x:Name="MouseOver">
                                                        <Storyboard>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="circle"
                                                                            Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)"
                                                                            To="#FF3C7FB1" />
                                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle"
                                                                                           Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="{StaticResource ExpanderArrowHoverFill}" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="arrow"
                                                                            Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)"
                                                                            To="#222" />
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Pressed">
                                                        <Storyboard>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="circle"
                                                                            Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)"
                                                                            To="#FF526C7B" />
                                                            <DoubleAnimation BeginTime="0"
                                                                             Storyboard.TargetName="circle"
                                                                             Storyboard.TargetProperty="StrokeThickness"
                                                                             To="1.5" />
                                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle"
                                                                                           Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="{StaticResource ExpanderArrowPressedFill}" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="arrow"
                                                                            Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)"
                                                                            To="#FF003366" />
                                                        </Storyboard>
                                                    </VisualState>
                                                </VisualStateGroup>
                                                <VisualStateGroup x:Name="FocusStates">
                                                    <VisualState x:Name="Focused">
                                                        <Storyboard>
                                                            <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                           Storyboard.TargetName="FocusVisualElement"
                                                                                           Storyboard.TargetProperty="Visibility">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="Visible" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Unfocused" />
                                                </VisualStateGroup>
                                            </VisualStateManager.VisualStateGroups>
                                            <Border Padding="{TemplateBinding Padding}">
                                                <Grid Background="Transparent">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="19" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
                                                    <Grid HorizontalAlignment="Left"
                                                          VerticalAlignment="Top">
                                                        <Grid.RenderTransform>
                                                            <TransformGroup>
                                                                <TransformGroup.Children>
                                                                    <TransformCollection>
                                                                        <RotateTransform Angle="180"
                                                                                         CenterX="9.5"
                                                                                         CenterY="9.5" />
                                                                    </TransformCollection>
                                                                </TransformGroup.Children>
                                                            </TransformGroup>
                                                        </Grid.RenderTransform>
                                                        <Ellipse x:Name="circle"
                                                                 Fill="{StaticResource ExpanderArrowFill}"
                                                                 Stroke="DarkGray"
                                                                 Height="19"
                                                                 HorizontalAlignment="Center"
                                                                 VerticalAlignment="Center"
                                                                 Width="19" />
                                                        <Path x:Name="arrow"
                                                              Stroke="#666"
                                                              StrokeThickness="2"
                                                              HorizontalAlignment="Center"
                                                              VerticalAlignment="Center"
                                                              Data="M 1,1.5 L 4.5,5 L 8,1.5" />
                                                    </Grid>
                                                    <ContentPresenter x:Name="header"
                                                                      HorizontalAlignment="Stretch"
                                                                      Margin="4,0,0,0"
                                                                      VerticalAlignment="Center"
                                                                      Grid.Column="1"
                                                                      Content="{TemplateBinding Content}"
                                                                      ContentTemplate="{TemplateBinding ContentTemplate}" />
                                                </Grid>
                                            </Border>
                                            <Rectangle x:Name="FocusVisualElement"
                                                       Stroke="#FF448DCA"
                                                       StrokeThickness="1"
                                                       IsHitTestVisible="false"
                                                       Visibility="Collapsed" />
                                        </Grid>
                                    </ControlTemplate>
                                    <ControlTemplate x:Key="ExpanderLeftHeaderTemplate"
                                                     TargetType="ToggleButton">
                                        <Grid Background="Transparent">
                                            <VisualStateManager.VisualStateGroups>
                                                <VisualStateGroup x:Name="CheckStates">
                                                    <VisualStateGroup.Transitions>
                                                        <VisualTransition GeneratedDuration="00:00:00" />
                                                    </VisualStateGroup.Transitions>
                                                    <VisualState x:Name="Checked">
                                                        <Storyboard>
                                                            <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                           Storyboard.TargetName="arrow"
                                                                                           Storyboard.TargetProperty="Data">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="M 1,4.5 L 4.5,1 L 8,4.5" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Unchecked" />
                                                </VisualStateGroup>
                                                <VisualStateGroup x:Name="CommonStates">
                                                    <VisualStateGroup.Transitions>
                                                        <VisualTransition GeneratedDuration="0" />
                                                        <VisualTransition GeneratedDuration="00:00:00.1"
                                                                          To="MouseOver" />
                                                        <VisualTransition GeneratedDuration="00:00:00.1"
                                                                          To="Pressed" />
                                                    </VisualStateGroup.Transitions>
                                                    <VisualState x:Name="Normal" />
                                                    <VisualState x:Name="MouseOver">
                                                        <Storyboard>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="circle"
                                                                            Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)"
                                                                            To="#FF3C7FB1" />
                                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle"
                                                                                           Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="{StaticResource ExpanderArrowHoverFill}" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="arrow"
                                                                            Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)"
                                                                            To="#222" />
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Pressed">
                                                        <Storyboard>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="circle"
                                                                            Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)"
                                                                            To="#FF526C7B" />
                                                            <DoubleAnimation BeginTime="0"
                                                                             Storyboard.TargetName="circle"
                                                                             Storyboard.TargetProperty="StrokeThickness"
                                                                             To="1.5" />
                                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle"
                                                                                           Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="{StaticResource ExpanderArrowPressedFill}" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="arrow"
                                                                            Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)"
                                                                            To="#FF003366" />
                                                        </Storyboard>
                                                    </VisualState>
                                                </VisualStateGroup>
                                                <VisualStateGroup x:Name="FocusStates">
                                                    <VisualState x:Name="Focused">
                                                        <Storyboard>
                                                            <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                           Storyboard.TargetName="FocusVisualElement"
                                                                                           Storyboard.TargetProperty="Visibility">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="Visible" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Unfocused" />
                                                </VisualStateGroup>
                                            </VisualStateManager.VisualStateGroups>
                                            <Border Padding="{TemplateBinding Padding}">
                                                <Grid Background="Transparent">
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="19" />
                                                        <RowDefinition Height="*" />
                                                    </Grid.RowDefinitions>
                                                    <Grid HorizontalAlignment="Center"
                                                          VerticalAlignment="Top">
                                                        <Grid.RenderTransform>
                                                            <TransformGroup>
                                                                <TransformGroup.Children>
                                                                    <TransformCollection>
                                                                        <RotateTransform Angle="90"
                                                                                         CenterX="9.5"
                                                                                         CenterY="9.5" />
                                                                    </TransformCollection>
                                                                </TransformGroup.Children>
                                                            </TransformGroup>
                                                        </Grid.RenderTransform>
                                                        <Ellipse x:Name="circle"
                                                                 Fill="{StaticResource ExpanderArrowFill}"
                                                                 Stroke="DarkGray"
                                                                 Height="19"
                                                                 HorizontalAlignment="Center"
                                                                 VerticalAlignment="Center"
                                                                 Width="19" />
                                                        <Path x:Name="arrow"
                                                              Stroke="#666"
                                                              StrokeThickness="2"
                                                              HorizontalAlignment="Center"
                                                              VerticalAlignment="Center"
                                                              Data="M 1,1.5 L 4.5,5 L 8,1.5" />
                                                    </Grid>
                                                    <ContentPresenter x:Name="header"
                                                                      HorizontalAlignment="Center"
                                                                      Margin="0,4,0,0"
                                                                      VerticalAlignment="Stretch"
                                                                      Grid.Row="1"
                                                                      Content="{TemplateBinding Content}"
                                                                      ContentTemplate="{TemplateBinding ContentTemplate}" />
                                                </Grid>
                                            </Border>
                                            <Rectangle x:Name="FocusVisualElement"
                                                       Stroke="#FF448DCA"
                                                       StrokeThickness="1"
                                                       IsHitTestVisible="false"
                                                       Visibility="Collapsed" />
                                        </Grid>
                                    </ControlTemplate>
                                    <ControlTemplate x:Key="ExpanderRightHeaderTemplate"
                                                     TargetType="ToggleButton">
                                        <Grid Background="Transparent">
                                            <VisualStateManager.VisualStateGroups>
                                                <VisualStateGroup x:Name="CheckStates">
                                                    <VisualStateGroup.Transitions>
                                                        <VisualTransition GeneratedDuration="00:00:00" />
                                                    </VisualStateGroup.Transitions>
                                                    <VisualState x:Name="Checked">
                                                        <Storyboard>
                                                            <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                           Storyboard.TargetName="arrow"
                                                                                           Storyboard.TargetProperty="Data">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="M 1,4.5 L 4.5,1 L 8,4.5" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Unchecked" />
                                                </VisualStateGroup>
                                                <VisualStateGroup x:Name="CommonStates">
                                                    <VisualStateGroup.Transitions>
                                                        <VisualTransition GeneratedDuration="0" />
                                                        <VisualTransition GeneratedDuration="00:00:00.1"
                                                                          To="MouseOver" />
                                                        <VisualTransition GeneratedDuration="00:00:00.1"
                                                                          To="Pressed" />
                                                    </VisualStateGroup.Transitions>
                                                    <VisualState x:Name="Normal" />
                                                    <VisualState x:Name="MouseOver">
                                                        <Storyboard>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="circle"
                                                                            Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)"
                                                                            To="#FF3C7FB1" />
                                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle"
                                                                                           Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="{StaticResource ExpanderArrowHoverFill}" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="arrow"
                                                                            Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)"
                                                                            To="#222" />
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Pressed">
                                                        <Storyboard>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="circle"
                                                                            Storyboard.TargetProperty="(Ellipse.Stroke).(SolidColorBrush.Color)"
                                                                            To="#FF526C7B" />
                                                            <DoubleAnimation BeginTime="0"
                                                                             Storyboard.TargetName="circle"
                                                                             Storyboard.TargetProperty="StrokeThickness"
                                                                             To="1.5" />
                                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="circle"
                                                                                           Storyboard.TargetProperty="(Ellipse.Fill)">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="{StaticResource ExpanderArrowPressedFill}" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                            <ColorAnimation BeginTime="0"
                                                                            Storyboard.TargetName="arrow"
                                                                            Storyboard.TargetProperty="(Path.Stroke).(SolidColorBrush.Color)"
                                                                            To="#FF003366" />
                                                        </Storyboard>
                                                    </VisualState>
                                                </VisualStateGroup>
                                                <VisualStateGroup x:Name="FocusStates">
                                                    <VisualState x:Name="Focused">
                                                        <Storyboard>
                                                            <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                           Storyboard.TargetName="FocusVisualElement"
                                                                                           Storyboard.TargetProperty="Visibility">
                                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                                        Value="Visible" />
                                                            </ObjectAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState x:Name="Unfocused" />
                                                </VisualStateGroup>
                                            </VisualStateManager.VisualStateGroups>
                                            <Border Padding="{TemplateBinding Padding}">
                                                <Grid Background="Transparent">
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="19" />
                                                        <RowDefinition Height="*" />
                                                    </Grid.RowDefinitions>
                                                    <Grid HorizontalAlignment="Center"
                                                          VerticalAlignment="Top">
                                                        <Grid.RenderTransform>
                                                            <TransformGroup>
                                                                <TransformGroup.Children>
                                                                    <TransformCollection>
                                                                        <RotateTransform Angle="270"
                                                                                         CenterX="9.5"
                                                                                         CenterY="9.5" />
                                                                    </TransformCollection>
                                                                </TransformGroup.Children>
                                                            </TransformGroup>
                                                        </Grid.RenderTransform>
                                                        <Ellipse x:Name="circle"
                                                                 Fill="{StaticResource ExpanderArrowFill}"
                                                                 Stroke="DarkGray"
                                                                 Height="19"
                                                                 HorizontalAlignment="Center"
                                                                 VerticalAlignment="Center"
                                                                 Width="19" />
                                                        <Path x:Name="arrow"
                                                              Stroke="#666"
                                                              StrokeThickness="2"
                                                              HorizontalAlignment="Center"
                                                              VerticalAlignment="Center"
                                                              Data="M 1,1.5 L 4.5,5 L 8,1.5" />
                                                    </Grid>
                                                    <ContentPresenter x:Name="header"
                                                                      HorizontalAlignment="Center"
                                                                      Margin="0,4,0,0"
                                                                      VerticalAlignment="Stretch"
                                                                      Grid.Row="1"
                                                                      Content="{TemplateBinding Content}"
                                                                      ContentTemplate="{TemplateBinding ContentTemplate}" />
                                                </Grid>
                                            </Border>
                                            <Rectangle x:Name="FocusVisualElement"
                                                       Stroke="#FF448DCA"
                                                       StrokeThickness="1"
                                                       IsHitTestVisible="false"
                                                       Visibility="Collapsed" />
                                        </Grid>
                                    </ControlTemplate>
                                </Grid.Resources>
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualStateGroup.Transitions>
                                            <VisualTransition GeneratedDuration="0" />
                                        </VisualStateGroup.Transitions>
                                        <VisualState x:Name="Normal" />
                                        <VisualState x:Name="Disabled">
                                            <Storyboard>
                                                <DoubleAnimation Duration="0"
                                                                 Storyboard.TargetName="DisabledVisualElement"
                                                                 Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                 To="1" />
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="FocusStates">
                                        <VisualState x:Name="Focused">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="FocusVisualElement"
                                                                               Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Unfocused" />
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="ExpansionStates">
                                        <VisualStateGroup.Transitions>
                                            <VisualTransition GeneratedDuration="0" />
                                        </VisualStateGroup.Transitions>
                                        <VisualState x:Name="Collapsed" />
                                        <VisualState x:Name="Expanded">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpandSite"
                                                                               Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="ExpandDirectionStates">
                                        <VisualStateGroup.Transitions>
                                            <VisualTransition GeneratedDuration="0" />
                                        </VisualStateGroup.Transitions>
                                        <VisualState x:Name="ExpandDown">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="rd1"
                                                                               Storyboard.TargetProperty="Height">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="cd0"
                                                                               Storyboard.TargetProperty="Width">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="ExpandUp">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpanderButton"
                                                                               Storyboard.TargetProperty="Template">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="{StaticResource ExpanderUpHeaderTemplate}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpanderButton"
                                                                               Storyboard.TargetProperty="(Grid.Row)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="1" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpandSite"
                                                                               Storyboard.TargetProperty="(Grid.Row)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="0" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="rd0"
                                                                               Storyboard.TargetProperty="Height">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="cd0"
                                                                               Storyboard.TargetProperty="Width">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="ExpandLeft">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpanderButton"
                                                                               Storyboard.TargetProperty="Template">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="{StaticResource ExpanderLeftHeaderTemplate}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpanderButton"
                                                                               Storyboard.TargetProperty="(Grid.Column)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="1" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpandSite"
                                                                               Storyboard.TargetProperty="(Grid.Row)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="0" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="rd0"
                                                                               Storyboard.TargetProperty="Height">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="cd0"
                                                                               Storyboard.TargetProperty="Width">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="ExpandRight">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpanderButton"
                                                                               Storyboard.TargetProperty="Template">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="{StaticResource ExpanderRightHeaderTemplate}" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpandSite"
                                                                               Storyboard.TargetProperty="(Grid.Row)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="0" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpandSite"
                                                                               Storyboard.TargetProperty="(Grid.Column)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="1" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="rd0"
                                                                               Storyboard.TargetProperty="Height">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="cd1"
                                                                               Storyboard.TargetProperty="Width">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Border x:Name="Background"
                                        Background="{TemplateBinding Background}"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="{TemplateBinding BorderThickness}"
                                        CornerRadius="3">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition x:Name="rd0"
                                                           Height="Auto" />
                                            <RowDefinition x:Name="rd1"
                                                           Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition x:Name="cd0"
                                                              Width="Auto" />
                                            <ColumnDefinition x:Name="cd1"
                                                              Width="Auto" />
                                        </Grid.ColumnDefinitions>
                                        <ToggleButton x:Name="ExpanderButton"
                                                      Margin="1"
                                                      MinHeight="0"
                                                      MinWidth="0"
                                                      FontFamily="{TemplateBinding FontFamily}"
                                                      FontSize="{TemplateBinding FontSize}"
                                                      FontStretch="{TemplateBinding FontStretch}"
                                                      FontStyle="{TemplateBinding FontStyle}"
                                                      FontWeight="{TemplateBinding FontWeight}"
                                                      Foreground="{TemplateBinding Foreground}"
                                                      HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                      Padding="{TemplateBinding Padding}"
                                                      Template="{StaticResource ExpanderDownHeaderTemplate}"
                                                      VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                      Content="{TemplateBinding Header}"
                                                      ContentTemplate="{TemplateBinding HeaderTemplate}"
                                                      Grid.Column="1"
                                                      Grid.Row="0"
                                                      IsChecked="{TemplateBinding IsExpanded}" />
                                        <ContentControl x:Name="ExpandSite"
                                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                        Margin="{TemplateBinding Padding}"
                                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                        Visibility="Collapsed"
                                                        FontFamily="{TemplateBinding FontFamily}"
                                                        FontSize="{TemplateBinding FontSize}"
                                                        FontStretch="{TemplateBinding FontStretch}"
                                                        FontStyle="{TemplateBinding FontStyle}"
                                                        FontWeight="{TemplateBinding FontWeight}"
                                                        Foreground="{TemplateBinding Foreground}"
                                                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                        Content="{TemplateBinding Content}"
                                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                                        Grid.Column="0"
                                                        Grid.Row="1"
                                                        Grid.ColumnSpan="2" />
                                    </Grid>
                                </Border>
                                <Border x:Name="DisabledVisualElement"
                                        IsHitTestVisible="false"
                                        Opacity="0"
                                        Background="#A5FFFFFF"
                                        CornerRadius="3" />
                                <Border x:Name="FocusVisualElement"
                                        IsHitTestVisible="false"
                                        Visibility="Collapsed"
                                        BorderThickness="1"
                                        CornerRadius="3">
                                    <Border.BorderBrush>
                                        <LinearGradientBrush EndPoint="0.5,1"
                                                             StartPoint="0.5,0">
                                            <GradientStop Color="#FFA3AEB9" />
                                            <GradientStop Color="#FF8399A9"
                                                          Offset="0.375" />
                                            <GradientStop Color="#FF718597"
                                                          Offset="0.375" />
                                            <GradientStop Color="#FF617584"
                                                          Offset="1" />
                                        </LinearGradientBrush>
                                    </Border.BorderBrush>
                                </Border>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="ArrowButtonStyle"
                   TargetType="Button">
                <Setter Property="Background"
                        Value="#FF1F3B53" />
                <Setter Property="Foreground"
                        Value="#FF000000" />
                <Setter Property="Padding"
                        Value="3" />
                <Setter Property="BorderThickness"
                        Value="1" />
                <Setter Property="BorderBrush">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1"
                                             StartPoint="0.5,0">
                            <GradientStop Color="#FFA3AEB9"
                                          Offset="0" />
                            <GradientStop Color="#FF8399A9"
                                          Offset="0.375" />
                            <GradientStop Color="#FF718597"
                                          Offset="0.375" />
                            <GradientStop Color="#FF617584"
                                          Offset="1" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <Grid>
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualState x:Name="Normal" />
                                        <VisualState x:Name="MouseOver">
                                            <Storyboard>
                                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                               Duration="00:00:00.0010000"
                                                                               Storyboard.TargetName="Background"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <EasingDoubleKeyFrame KeyTime="00:00:00"
                                                                          Value="0.43" />
                                                </DoubleAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Pressed">
                                            <Storyboard>
                                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                               Duration="00:00:00.0010000"
                                                                               Storyboard.TargetName="Background"
                                                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <EasingDoubleKeyFrame KeyTime="00:00:00"
                                                                          Value="0.8" />
                                                </DoubleAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Disabled">
                                            <Storyboard>
                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement"
                                                                               Storyboard.TargetProperty="Opacity">
                                                    <SplineDoubleKeyFrame KeyTime="0"
                                                                          Value="0.4" />
                                                </DoubleAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="FocusStates">
                                        <VisualState x:Name="Focused">
                                            <Storyboard>
                                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                               Duration="00:00:00.0010000"
                                                                               Storyboard.TargetName="Path"
                                                                               Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Opacity)">
                                                    <EasingDoubleKeyFrame KeyTime="00:00:00"
                                                                          Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Unfocused" />
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Border x:Name="Background"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="{TemplateBinding BorderThickness}"
                                        CornerRadius="3"
                                        Opacity="0"
                                        Background="{TemplateBinding Background}" />

                                <Path x:Name="Path"
                                      Canvas.Left="0"
                                      Canvas.Top="-3.8147e-006"
                                      Stretch="Fill"
                                      Fill="{StaticResource ArrowFillBrush}"
                                      Data="F1 M 0.187502,11.3125L 48.0625,11.25L 43.1875,-3.8147e-006L 88.625,22.125L 43.3125,45.6875L 47.8125,33.4375L 0,33.1875L 0.187502,11.3125 Z "
                                      HorizontalAlignment="Center"
                                      VerticalAlignment="Center"
                                      Margin="3">
                                    <Path.Effect>
                                        <DropShadowEffect Opacity="0"
                                                          ShadowDepth="2" />
                                    </Path.Effect>
                                </Path>

                                <Rectangle x:Name="DisabledVisualElement"
                                           Fill="#FFFFFFFF"
                                           RadiusX="3"
                                           RadiusY="3"
                                           IsHitTestVisible="false"
                                           Opacity="0" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="ExpanderNoButtonStyle"
                   TargetType="controlsToolkit:Expander">
                <Setter Property="Background"
                        Value="Transparent" />
                <Setter Property="BorderBrush"
                        Value="Transparent" />
                <Setter Property="BorderThickness"
                        Value="1" />
                <Setter Property="HorizontalContentAlignment"
                        Value="Stretch" />
                <Setter Property="VerticalContentAlignment"
                        Value="Stretch" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="controlsToolkit:Expander">
                            <Grid Background="Transparent">
                                <vsm:VisualStateManager.VisualStateGroups>
                                    <vsm:VisualStateGroup x:Name="CommonStates">
                                        <vsm:VisualStateGroup.Transitions>
                                            <vsm:VisualTransition GeneratedDuration="0" />
                                        </vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualState x:Name="Normal" />
                                        <vsm:VisualState x:Name="Disabled">
                                            <Storyboard>
                                                <DoubleAnimation Duration="0"
                                                                 Storyboard.TargetName="DisabledVisualElement"
                                                                 Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                 To="1" />
                                            </Storyboard>
                                        </vsm:VisualState>
                                    </vsm:VisualStateGroup>
                                    <vsm:VisualStateGroup x:Name="FocusStates">
                                        <vsm:VisualState x:Name="Focused">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="FocusVisualElement"
                                                                               Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </vsm:VisualState>
                                        <vsm:VisualState x:Name="Unfocused" />
                                    </vsm:VisualStateGroup>
                                    <vsm:VisualStateGroup x:Name="ExpansionStates">
                                        <vsm:VisualStateGroup.Transitions>
                                            <vsm:VisualTransition GeneratedDuration="0" />
                                        </vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualState x:Name="Collapsed" />
                                        <vsm:VisualState x:Name="Expanded">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpandSite"
                                                                               Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="Visible" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </vsm:VisualState>
                                    </vsm:VisualStateGroup>
                                    <vsm:VisualStateGroup x:Name="ExpandDirectionStates">
                                        <vsm:VisualStateGroup.Transitions>
                                            <vsm:VisualTransition GeneratedDuration="0" />
                                        </vsm:VisualStateGroup.Transitions>
                                        <vsm:VisualState x:Name="ExpandDown">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="rd1"
                                                                               Storyboard.TargetProperty="Height">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="cd0"
                                                                               Storyboard.TargetProperty="Width">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </vsm:VisualState>
                                        <vsm:VisualState x:Name="ExpandUp">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpanderButton"
                                                                               Storyboard.TargetProperty="(Grid.Row)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="1" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpandSite"
                                                                               Storyboard.TargetProperty="(Grid.Row)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="0" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="rd0"
                                                                               Storyboard.TargetProperty="Height">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="cd0"
                                                                               Storyboard.TargetProperty="Width">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </vsm:VisualState>
                                        <vsm:VisualState x:Name="ExpandLeft">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpanderButton"
                                                                               Storyboard.TargetProperty="(Grid.Column)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="1" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpandSite"
                                                                               Storyboard.TargetProperty="(Grid.Row)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="0" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="rd0"
                                                                               Storyboard.TargetProperty="Height">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="cd0"
                                                                               Storyboard.TargetProperty="Width">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </vsm:VisualState>
                                        <vsm:VisualState x:Name="ExpandRight">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpandSite"
                                                                               Storyboard.TargetProperty="(Grid.Row)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="0" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="ExpandSite"
                                                                               Storyboard.TargetProperty="(Grid.Column)">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="1" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="rd0"
                                                                               Storyboard.TargetProperty="Height">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Duration="0"
                                                                               Storyboard.TargetName="cd1"
                                                                               Storyboard.TargetProperty="Width">
                                                    <DiscreteObjectKeyFrame KeyTime="0"
                                                                            Value="*" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </vsm:VisualState>
                                    </vsm:VisualStateGroup>
                                </vsm:VisualStateManager.VisualStateGroups>
                                <Border x:Name="Background"
                                        Background="{TemplateBinding Background}"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="{TemplateBinding BorderThickness}"
                                        CornerRadius="3">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"
                                                           x:Name="rd0" />
                                            <RowDefinition Height="Auto"
                                                           x:Name="rd1" />
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"
                                                              x:Name="cd0" />
                                            <ColumnDefinition Width="Auto"
                                                              x:Name="cd1" />
                                        </Grid.ColumnDefinitions>
                                        <CheckBox Content="{TemplateBinding Header}"
                                                  ContentTemplate="{TemplateBinding HeaderTemplate}"
                                                  FontFamily="{TemplateBinding FontFamily}"
                                                  FontSize="{TemplateBinding FontSize}"
                                                  FontStretch="{TemplateBinding FontStretch}"
                                                  FontStyle="{TemplateBinding FontStyle}"
                                                  FontWeight="{TemplateBinding FontWeight}"
                                                  Foreground="{TemplateBinding Foreground}"
                                                  Grid.Column="0"
                                                  Grid.Row="0"
                                                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  IsChecked="{TemplateBinding IsExpanded}"
                                                  Margin="1"
                                                  MinHeight="0"
                                                  MinWidth="0"
                                                  x:Name="ExpanderButton"
                                                  Padding="{TemplateBinding Padding}"
                                                  VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
                                        <ContentControl Content="{TemplateBinding Content}"
                                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                                        FontFamily="{TemplateBinding FontFamily}"
                                                        FontSize="{TemplateBinding FontSize}"
                                                        FontStretch="{TemplateBinding FontStretch}"
                                                        FontStyle="{TemplateBinding FontStyle}"
                                                        FontWeight="{TemplateBinding FontWeight}"
                                                        Foreground="{TemplateBinding Foreground}"
                                                        Grid.Column="0"
                                                        Grid.Row="1"
                                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                        Margin="{TemplateBinding Padding}"
                                                        x:Name="ExpandSite"
                                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                                        Visibility="Collapsed" />
                                    </Grid>
                                </Border>
                                <Border x:Name="DisabledVisualElement"
                                        IsHitTestVisible="false"
                                        Opacity="0"
                                        Background="#A5FFFFFF"
                                        CornerRadius="3" />
                                <Border x:Name="FocusVisualElement"
                                        IsHitTestVisible="false"
                                        Visibility="Collapsed"
                                        BorderThickness="1"
                                        CornerRadius="3">
                                    <Border.BorderBrush>
                                        <LinearGradientBrush EndPoint="0.5,1"
                                                             StartPoint="0.5,0">
                                            <GradientStop Color="#FFA3AEB9" />
                                            <GradientStop Color="#FF8399A9"
                                                          Offset="0.375" />
                                            <GradientStop Color="#FF718597"
                                                          Offset="0.375" />
                                            <GradientStop Color="#FF617584"
                                                          Offset="1" />
                                        </LinearGradientBrush>
                                    </Border.BorderBrush>
                                </Border>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Name="ComboToggleButton"
                   TargetType="ToggleButton">
                <Setter Property="Foreground"
                        Value="#FF333333" />
                <Setter Property="IsTabStop"
                        Value="False" />
                <Setter Property="Background"
                        Value="#FF1F3B53" />
                <Setter Property="Padding"
                        Value="0" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ToggleButton">
                            <Grid>
                                <Rectangle Fill="Transparent" />
                                <ContentPresenter x:Name="contentPresenter"
                                                  Content="{TemplateBinding Content}"
                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                  Margin="{TemplateBinding Padding}" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="AutoCompleteComboBoxStyle"
                   TargetType="input:AutoCompleteBox">

                <!-- ComboBox should not perform text completion by default -->
                <Setter Property="IsTextCompletionEnabled"
                        Value="False" />

                <!-- The minimum prefix length should be 0 for combo box scenarios -->
                <Setter Property="MinimumPrefixLength"
                        Value="0" />

                <!-- Regular template values -->
                <Setter Property="Background"
                        Value="#FF1F3B53" />
                <Setter Property="IsTabStop"
                        Value="False" />
                <Setter Property="HorizontalContentAlignment"
                        Value="Left" />
                <Setter Property="BorderBrush">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1"
                                             StartPoint="0.5,0">
                            <GradientStop Color="#FFA3AEB9"
                                          Offset="0" />
                            <GradientStop Color="#FF8399A9"
                                          Offset="0.375" />
                            <GradientStop Color="#FF718597"
                                          Offset="0.375" />
                            <GradientStop Color="#FF617584"
                                          Offset="1" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="input:AutoCompleteBox">
                            <Grid Margin="{TemplateBinding Padding}">
                                <TextBox IsTabStop="True"
                                         x:Name="Text"
                                         Style="{TemplateBinding TextBoxStyle}"
                                         Margin="0" />
                                <ToggleButton HorizontalAlignment="Right"
                                              VerticalAlignment="Center"
                                              Style="{StaticResource ComboToggleButton}"
                                              Margin="0"
                                              HorizontalContentAlignment="Center"
                                              Background="{TemplateBinding Background}"
                                              BorderThickness="0"
                                              Height="16"
                                              Width="16"
                                              Click="DropDownToggle_Click">
                                    <ToggleButton.Content>
                                        <Path x:Name="BtnArrow"
                                              Height="4"
                                              Width="8"
                                              Stretch="Uniform"
                                              Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z "
                                              Margin="0,0,6,0"
                                              HorizontalAlignment="Right">
                                            <Path.Fill>
                                                <SolidColorBrush x:Name="BtnArrowColor"
                                                                 Color="#FF333333" />
                                            </Path.Fill>
                                        </Path>
                                    </ToggleButton.Content>
                                </ToggleButton>
                                <Popup x:Name="Popup">
                                    <Border x:Name="PopupBorder"
                                            HorizontalAlignment="Stretch"
                                            Opacity="1.0"
                                            BorderThickness="0"
                                            CornerRadius="3">
                                        <Border.RenderTransform>
                                            <TranslateTransform X="2"
                                                                Y="2" />
                                        </Border.RenderTransform>
                                        <Border.Background>
                                            <SolidColorBrush Color="#11000000" />
                                        </Border.Background>
                                        <Border HorizontalAlignment="Stretch"
                                                BorderThickness="0"
                                                CornerRadius="3">
                                            <Border.Background>
                                                <SolidColorBrush Color="#11000000" />
                                            </Border.Background>
                                            <Border.RenderTransform>
                                                <TransformGroup>
                                                    <ScaleTransform />
                                                    <SkewTransform />
                                                    <RotateTransform />
                                                    <TranslateTransform X="-1"
                                                                        Y="-1" />
                                                </TransformGroup>
                                            </Border.RenderTransform>
                                            <Border HorizontalAlignment="Stretch"
                                                    Opacity="1.0"
                                                    Padding="2"
                                                    BorderThickness="2"
                                                    BorderBrush="{TemplateBinding BorderBrush}"
                                                    CornerRadius="3">
                                                <Border.RenderTransform>
                                                    <TransformGroup>
                                                        <ScaleTransform />
                                                        <SkewTransform />
                                                        <RotateTransform />
                                                        <TranslateTransform X="-2"
                                                                            Y="-2" />
                                                    </TransformGroup>
                                                </Border.RenderTransform>
                                                <Border.Background>
                                                    <LinearGradientBrush EndPoint="0.5,1"
                                                                         StartPoint="0.5,0">
                                                        <GradientStop Color="#FFDDDDDD"
                                                                      Offset="0" />
                                                        <GradientStop Color="#AADDDDDD"
                                                                      Offset="1" />
                                                    </LinearGradientBrush>
                                                </Border.Background>
                                                <ListBox x:Name="Selector"
                                                         ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                                         ScrollViewer.VerticalScrollBarVisibility="Auto"
                                                         ItemTemplate="{TemplateBinding ItemTemplate}" />
                                            </Border>
                                        </Border>
                                    </Border>
                                </Popup>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

        </ResourceDictionary>
    </Application.Resources>


    <Application.ApplicationLifetimeObjects>
        <app:WebContext>
            <app:WebContext.Authentication>
                <appsvc:FormsAuthentication DomainContextType="SoftSource.Timecard.Web.AuthenticationContext, SoftSource.Timecard.Data, Version=1.0.0.0" />
            </app:WebContext.Authentication>
        </app:WebContext>
    </Application.ApplicationLifetimeObjects>

</Application>